import {request} from 'umi';
import {IAddUser,IAddIdentity,IAddApiAuthority,IAddAuthorityView,ISetIdentityApi,ISetIdentityView} from '@/interface/consumer';


//身份id
export const getUserIdentity = () => {
    return request('/user/identity')
}

//获取已有视图权限数据
export const getviewAuthority = () => {
    return request('/user/view_authority')
}

//获取api权限数据

export const getApiAuthority = () =>{
    return request('/user/api_authority')
}

//添加用户

export const addUser = (data:IAddUser) => {
    return request('/user',{method:'post',data})
}

//添加身份

export const addIdentity = (data:IAddIdentity) => {
    return request('/user/identity/edit',{method:'post',data})
}

//添加api接口权限

export const addApiAuthority = (data:IAddApiAuthority) => {
    return request('/user/authorityApi/edit',{method:'post',data})
}

//添加视图接口权限

export const addAuthorityView = (data:IAddAuthorityView) => {
    return request('/user/authorityView/edit',{method:'post',data})
}

//给身份设置api接口权限

export const setIdentityApi = (data:ISetIdentityApi) => {
    return request('/user/setIdentityApi',{method:'post',data})
}

//给身份设置视图权限

export const setIdentityView = (data:ISetIdentityView) => {
    return request('/user/setIdentityView',{method:'post',data})
}